Networks typically include network elements, such as routers, switches, or gateways, which transfer or switch data from one or more sources to one or more destinations. A network element may process data units. For example, the network element may receive a data unit from a source device (or another network element), may determine a destination for the data unit, and may send an original or a modified data unit to a destination device (or another network element).
A packet is one type of data unit in which encapsulated data can be transmitted through a network and which may vary in size. A network element may receive packets from a large number of sources and may therefore handle a large number of packet streams. As the network element has limited resources, the network element may need to allocate resources among the large number of packet streams. For example, the network element may need to store particular packet streams in queues and may need to schedule the queues in a fair manner. One example of a fair queueing process is a round robin process, which removes one packet at a time from each queue in a round robin fashion. However, packets may vary greatly in size (e.g., length of packets in number of bytes), and a first queue that includes large packets may receive an unfair share of resources in comparison to a second queue that includes smaller packets.
One improvement of the round robin process is a deficit round robin process. In a deficit round robin process, particular queues are assigned a number of credits for a particular round, and when a packet is removed from a queue, the size of the packet is subtracted from the credits. When removing another packet would reduce the queue's credits to zero, the process moves to a next queue in the round robin process. While a deficit round robin process may take into account packet size, a particular queue may nevertheless consume more than a fair share of network element resources. Thus, distributing resources of a network element among queues in a fair manner may prove to be quite challenging.